const {
    remote,
    ipcRenderer,
    shell
} = require('electron');

const btn_open = document.querySelector("#btn_open");
btn_open.onclick = (e) => {
    console.log('xxx')
    e.preventDefault();
    window.open('https://www.baidu.com')
}

const aHref = document.querySelector("#ahref");

aHref.onclick = (e) => {
    e.preventDefault();
    const href = aHref.getAttribute('href');
    shell.openExternal(href);
}

const btn_send_parent = document.querySelector("#send_parent");
btn_send_parent.onclick = (e) => {
    //window.opener.postMessage('我是子窗体，我发送了这个消息', targetOrigin)
    console.log(window.opener);
    alert(` 使用window.open('./render-process/red.html') 方式可以通过这个方式，使用BrowseWindws的不行`)
    window.opener.postMessage('我是子窗体，我发送了这个消息')
}